//自主飞行、变质量选择

import {ref,computed} from 'vue';
import { useVarChooseStore } from '@/store/varChoose'
import { storeToRefs } from "pinia";

export default function useConfigFile() {
const varChooseStore = useVarChooseStore()
const { jsonMsg } = storeToRefs(varChooseStore)
const checkedItems_9 = ref<any>([]);    //多选框-2
const popoverVisible_9 = ref(false);      // 控制 Popover 显示/隐藏 ---多选框
const options_9 = computed(() => jsonMsg.value?.sequence[8]?.items ?? [])
// 确认选择
const confirmSelection_9 = () => {
    console.log('选中的值：', checkedItems_9.value);
    popoverVisible_9.value = false;
};

//输入框
const handleInputChange_9 = (value: any) => {
    console.log('当前输入值:', value);
};

// 处理全选/取消全选
const handleCheckAllChange_9 = (val: any, item: any) => {
    item.default = val ? item.editor.options.map((opt: any) => opt.value) : []
    item.indeterminate = false
}

// 处理选项变化
const handleSelectChange_9 = (item: any) => {
    const checkedCount = item.default.length
    item.checkAll = checkedCount === item.editor.options.length
    item.indeterminate = checkedCount > 0 && checkedCount < item.editor.options.length
}

const handleSelectChange_91 = (item: any) => {
    console.log('选择变化p配平反馈:', item);
}

return {checkedItems_9,popoverVisible_9,options_9,confirmSelection_9,handleInputChange_9,handleCheckAllChange_9,handleSelectChange_9,handleSelectChange_91}

}